<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page session="true"%>
<%@page import="java.util.*"%>
<%@page import="tr.com.argela.tap.mot.models.Project"%>
<%@page import="tr.com.argela.tap.mot.models.Module"%>
<%@page import="tr.com.argela.tap.mot.models.User"%>
<%@page import="tr.com.argela.tap.mot.models.TestPoint"%>
<%@page import="tr.com.argela.tap.mot.dao.ProjectDao"%>
<%@page import="tr.com.argela.tap.mot.dao.ModuleDao"%>
<%@page import="java.sql.*"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   <html>
<head>

<title>JSP Page</title>
<link rel="stylesheet" type="text/css" href="style/styles.css">
</head>
<body>
  
  <%
     User user = (User)request.getSession().getAttribute("userObject");
     String name = user.getName();
     
%>
  <h4 align="right"><%=name%></h4>
  <h5 align="right"><a href="logout.jsp">Log out</a></h5>
       <dıv> <h1 align="center">MOT</h1><h5 align="center">Memory Of Testing</h5></dıv>
       <dıv>
       <table border="1" align="center">

<tr><td><B>Project Names</B></td>


<% 
//call db method



ProjectDao proDao = new ProjectDao();

List<Project> projects = proDao.seeProjects();

for (Project project : projects) {
%> 

<td><a href="properties.jsp?id=<%=project.getId()%>"><%=project.getName()%></a></td>
<% }

%>
</tr> 

</table>
</dıv>
<br><br><br><br>
          <dıv align="left">
        <table align="left">
         <tr><td>
	        <h4><a href="currentProjects.jsp">Current Projects</a></h4>
	    </td></tr>
	      <tr><td>
	      	<h4><a href="createProject.jsp">Create Project</a></h4>
	    </td></tr>
	       <tr><td>
	         <h4><a href="projectVersion.jsp">Create Project Version</a></h4>
	    </td></tr>
	       <tr><td>
	         <h4><a href="versions.jsp">Project Versions</a></h4>
	    </td></tr>
	        <tr><td>
	          <h4><a href="users.jsp">Users</a></h4>
	    </td></tr>
	        <tr><td>
	           <h4><a href="export.jsp">Export Document</a></h4>
	    </td></tr>
        </table>
        </dıv><dıv align="right">
<% 
//call db method



if(request.getParameter("id2")==null)
	response.sendRedirect("properties.jsp");


ProjectDao projectDao = new ProjectDao();

Project project = projectDao.checkproject(Long.parseLong((String)request.getParameter("id2")));

%>
<table><tr>
 <th align="center"><%=project.getName()%>'s Modules</th>
<%
ModuleDao moduleDao = new ModuleDao();
List<Module> modules = moduleDao.seemodule(Long.parseLong((String)request.getParameter("id2")));

for (Module module : modules) {
%> 

<tr><td><a href="modules.jsp?id5=<%=module.getId()%>"><%=module.getName()%></a></td></tr> 
<% 
}
%>
</table>

	          <h4 align="center"><a href="createModule.jsp">Create Module</a></h4>
	          
</dıv>

</body>
</html>